Passed
Branch master (fccad1)
by Stefan
07:59
created

option_expand.js ➔ processCredentials   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
nc 2
nop 0
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
/* 
2
 *******************************************************************************
3
 * Copyright 2011-2017 DANTE Ltd. and GÉANT on behalf of the GN3, GN3+, GN4-1 
4
 * and GN4-2 consortia
5
 *
6
 * License: see the web/copyright.php file in the file structure
7
 *******************************************************************************
8
 */
9
10
/* General function for doing HTTP XML GET requests. */
11
12
function getXML(attribute_class) {
13
    var client = new XMLHttpRequest();
14
    client.attribute_class = attribute_class;
15
    client.onreadystatechange = addOption;
16
    client.open("GET", "inc/option_xhr.inc.php?class=" + attribute_class + "&etype=XML");
17
    client.send();
18
}
19
20
function addOption(attribute_class) {
21
    if (this.readyState === 4 && this.status === 200) {
22
        var field = document.getElementById("expandable_" + this.attribute_class + "_options");
23
        var div = document.createElement('tbody');
24
        div.innerHTML = this.responseText;
25
        field.appendChild(div.firstChild);
26
    }
27
}
28
29
function processCredentials() {
30
    if (this.readyState === 4 && this.status === 200) {
31
        var field = document.getElementById("disposable_credential_container");
32
        field.innerHTML = this.responseText;
33
    }
34
}
35
36
function doCredentialCheck(form) {
37
    postXML(processCredentials, form);
38
}
39
40
function deleteOption(e, identifier) {
41
    /* the marks variable is set by a script in edit_idp.php */
42
    /** global: marks */
43
    var field = document.getElementById(identifier);
44
    if (e) {
45
        marks[e - 1].setOptions({visible: false});
1 ignored issue
show
Bug introduced by
The variable marks seems to be never declared. If this is a global, consider adding a /** global: marks */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
46
    }
47
    field.parentNode.removeChild(field);
48
}
49